define(function(require, exports, module) {
    "require:nomunge,exports:nomunge,module:nomunge";
    "use strict";
    
    var service = require('./service');
    var User = require("./User");
    
    /*=========校友列表========*/
   
    exports.list = [];
    exports.args = {
    	userId: User.state.userId
    };
    //获取列表
    exports.getList = function(callback){
        service.contact.getList(this.args, function(rs, err) {
            if (err && callback) return callback(err.message || err);
            if (rs.success) {
            	exports.list = rs.obj;
                if (callback) callback();
            } else {
                rs = rs || {};
                var msg = rs.msg || 'unknow error';
                if (callback) callback(msg);
            }
        }); 
    };

    /*=========添加好友========*/
   
	exports.addArgs = {
		userId: User.state.userId,
		userFriendId: "",
		isFriend: 1
	};

    //添加好友
    exports.addUser = function(fid, callback){
    	this.addArgs.userFriendId = fid;
        service.contact.addUser(this.addArgs, function(rs, err) {
            if (err && callback) return callback(err.message || err);
            if (rs.success) {
                if (callback) callback();
            } else {
                rs = rs || {};
                var msg = rs.msg || 'unknow error';
                if (callback) callback(msg);
            }
        }); 
    };
 });